package com.bgs.eat.login.controller;

import com.bgs.eat.config.CommonResult;
import com.bgs.eat.login.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName LoginController
 * @Description TODO
 * @Author hbx
 * @Date 2022/10/10 20:40
 **/
@RestController
@CrossOrigin
@RequestMapping("/login")
public class LoginController {

    @Autowired
    LoginService loginService;


   /**
   * @Author hbx
   * @Description 前端根据账号密码登录
   * @Date 2022/10/10 20:48
   * @param userName
   * @param password
   */
    @GetMapping("/loginByUser")
    public CommonResult loginByUser(String userName, String password){
        return loginService.loginByUser(userName,password);
    }
    /**
    * @Author hbx
    * @Description 前端根据手机号验证登录
    * @Date 2022/10/12 10:04
    * @param phone
    * @param code
    */
    @GetMapping("/loginByPhoneCode")
    public CommonResult loginByPhoneCode(String phone, String code,String codeMark){
        return loginService.loginByPhoneCode(phone,code,codeMark);
    }

}




